<template>
  <div>
    <el-dialog v-model="dialogVisible" width="750px">
      <template #title>
        <el-input class="search-input" placeholder="点击输入筛选标签名称" />
      </template>
      <el-card shadow="never">
        <el-table :data="tableList" style="width: 100%">
          <el-table-column label="字段名称" width="190">
            <template #default="scope">
              <el-select v-model="scope.name" placeholder="请选择" size="default">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="筛选条件" width="190">
            <template #default="scope">
              <el-select v-model="scope.condition" placeholder="请选择"  size="default">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="筛选类型" width="190">
            <template #default="scope">
              <el-select v-model="scope.type" placeholder="请选择"  size="default">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column align="center">
            <template #default="scope">
              <!-- <el-button type="text"><svg-icon name="locking" /> </el-button> -->
              <el-button type="text"  size="default">
                <svg-icon icon-class="unlock" />
              </el-button>
              <el-button type="text"  size="default">
                <svg-icon icon-class="close" />
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-button class="addButton" type="text" size="default"  @click="handleAdd">
          <svg-icon icon-class="add" />
          <span style="margin-left: 8px;">添加</span>
        </el-button>
      </el-card>
      <template #footer>
        <span class="dialog-footer">
          <el-button size="default"  @click="dialogVisible = false">保存标签</el-button>
          <el-button type="primary" size="default"  @click="dialogVisible = false">确 定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs } from 'vue'
export default defineComponent({
  setup(prop, context) {
    const state = reactive({
      dialogVisible: false,
      row: {
        name: '2016-05-02',
        type: '王小虎',
        condition: '上海市普陀区金沙江路 1518 弄'
      },
      tableList: [
        {
          name: '2016-05-02',
          type: '王小虎',
          condition: '上海市普陀区金沙江路 1518 弄'
        }
      ],
      options: [{value:'test',label:'test'}]
    })
    const handleAdd = () => {
      state.tableList.push(state.row)
    }

    return {
      ...toRefs(state),
      handleAdd
    }
  }
})
</script>

<style lang="scss" scoped>
.addButton {
  margin-left: 10px;
  color: #333;
}
.search-input {
  ::v-deep(.el-input__inner) {
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-left: 3px solid #326be6;
    border-radius: 0px;
  }
}
</style>
